<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>getheight</title>
  <script>
    window.addEventListener("orientationchange", function() {

      // setTimeout(function (){
      //   alert(getWindowHeight())
      // }, 1000);

      alert(getWindowHeight())
    })
    function getWindowHeight() {
      var a = 630,
        b = 460;
      return document.body &&
        document.body.offsetWidth &&
        (a = document.body.offsetWidth, b = document.body.offsetHeight), "CSS1Compat" == document.compatMode &&
        document.documentElement &&
        document.documentElement.offsetWidth &&
        (a = document.documentElement.offsetWidth, b = document.documentElement.offsetHeight), window.innerWidth &&
        window.innerHeight &&
        (a = window.innerWidth, b = window.innerHeight), .99 * b
    }
    
    // setTimeout(function(){
    //     alert(getWindowHeight())
    //   }, 1000);

      alert(getWindowHeight())
  </script>
</head>

<body>
  <h2>rotate 页面翻转</h2>
</body>

</html>